﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ThouShaltNotBrick.Models;
using Microsoft.Xna.Framework.Content;

namespace ThouShaltNotBrick.PipelineExtension.Readers
{
    public sealed class CampaignContentTypeReader : ContentTypeReader<CampaignData>
    {
        #region Overriden Methods
        protected override CampaignData Read(ContentReader pInput, CampaignData pExistingInstance)
        {
            // NAME (string)
            // NUMBER OF LEVELS (int)
            //   NAME (string)

            string campaignName = pInput.ReadString();

            int numLevels = pInput.ReadInt32();
            List<string> levelList = new List<string>(numLevels);
            for (int i = 0; i < numLevels; i++)
            {
                string levelName = pInput.ReadString();
                levelList.Add(levelName);
            }

            CampaignData campaign = new CampaignData(campaignName, levelList);
            return campaign;
        }
        #endregion
    }
}